---
id: 65c63a4c4da62e9ae18e321a
title: Step 19
challengeType: 20
dashedName: step-19
---

# --description--

It's time to work on the search functionality. Just like you created a helper method `_insert` for the `insert` method, you need to create a helper method `_search` for the `search` method.

Define the `_search` method with three parameters, namely `self`,`node` and `key`.

# --hints--

You should declare a `_search` method. Note the leading underscore and remember to use `pass`.

```js
({ test: () => assert.match(code, /def\s+_search/) });
```

Your `_search` method should take three parameters: `self`, `node`, and `key`.

```js
({ test: () => assert.match(code, /def\s+_search\(\s*self\s*,\s*node\s*,\s*key\s*\)/) });
```

# --seed--

## --seed-contents--

```py

class TreeNode:

    def __init__(self, key):
        self.key = key
        self.left = None
        self.right = None


class BinarySearchTree:

    def __init__(self):
        self.root = None

    def _insert(self, node, key):
        if node is None:
            return TreeNode(key)

        if key < node.key:
            node.left = self._insert(node.left, key)
        elif key > node.key:

            node.right = self._insert(node.right, key)
        return node

    def insert(self, key):
        self.root = self._insert(self.root, key)
--fcc-editable-region--

--fcc-editable-region--
```
